﻿@model workflowMVC.Models.StudentDetailModel

@{
    ViewBag.Title = "StudentDetail";
}

<table class="ui-widget-content ui-corner-all" style="margin:auto;padding:5px">  
        <tr>
            <td>
                @Html.LabelFor(model => model.Name)
            </td>
            <td>
                @Html.TextBoxFor(model => model.Name, new { @readonly = "true" })
            </td>
        </tr>       
      
        <tr>
            <td>
                @Html.LabelFor(model => model.NumCode)
            </td>
            <td>
                @Html.TextBoxFor(model => model.NumCode, new { @readonly = "true" })
            </td>
        </tr>
        <tr>
            <td>
                @Html.LabelFor(model => model.Email)
            </td>
            <td>
                @Html.TextBoxFor(model => model.Email, new { @readonly = "true" })
            </td>
        </tr>
        
        <tr>
            <td>
                @Html.LabelFor(model => model.DoB)
            </td>
            <td>
                @Html.TextBoxFor(model => model.DoB, new {@readonly="true" })
            </td>
        </tr>
        <tr>
            <td>
                @Html.LabelFor(model => model.Address)
            </td>
            <td>
                @Html.TextBoxFor(model => model.Address, new { @readonly = "true" })
            </td>
        </tr>  
        <tr>
            <td>
                @Html.LabelFor(model => model.Class)
            </td>
            <td>
                @Html.TextBoxFor(m => m.Class, new { @readonly = "true" })
            </td>
        </tr>
        
        <tr>
            <td>
                @Html.LabelFor(model => model.StartYear)
            </td>
            <td>
                @Html.TextBoxFor(m => m.StartYear, new { @readonly = "true" })
            </td>
        </tr>
        
        <tr>
            <td>
                @Html.LabelFor(model => model.TimeLast)
            </td>
            <td>
                @Html.TextBoxFor(m => m.TimeLast, new { @readonly = "true" })
            </td>
        </tr>
        
        <tr>
            <td>
                @Html.LabelFor(model => model.EduMode)
            </td>
            <td>
                @Html.TextBoxFor(m => m.EduMode, new { @readonly = "true" })
            </td>
        </tr>        
    </table>

    <div id="Logs">
    @Html.LabelFor(model => model.Logs)
    <br />
    <hr />
    @foreach (var i in Model.Logs)
    {
        <p>@i</p>
    }
    </div>
    @{if(Model.IsApprove)
        {
          <input type="submit" id="lock" value = "Khóa tài khoản này" />
        }
      else
      {
          <input type="submit" id="unlock" value = "mở khóa tài khoản này" />          
      }
    }
        <script type="text/javascript">
            $(document).ready(function () {
                $("#lock").live("click", function (event) {
                    $.ajax({
                        url: '@Url.Action("LockStudent")',
                        type: "PUT",
                        data: "id=@Model.NumCode",
                        success: function (data) {
                            alert("khóa tài khoản thành công");
                            window.location.reload();
                        }
                    });
                    
                    return false;
                });
                $("#unlock").live("click", function (event) {
                    $.ajax({
                        url: '@Url.Action("UnlockStudent")',
                        type: "PUT",
                        data: "id=@Model.NumCode",
                        success: function (data) {
                            alert("mở khóa tài khoản thành công");
                            window.location.reload();
                        }
                    });
                    
                    return false;
                });
            });
</script>

